﻿using System;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using ACM.cmsarea08.DBManager;
using ACM.cmsarea08;
using ACM.cmsarea08.mainconfiguration;
using System.Xml;


namespace ACM.ControlGallery.FileManager.Related
{
	/// <summary>
	/// Description of WebControl1
	/// </summary>
	public class ActBtm : ACM.cmsarea08.Controls.RelatedButton
	{	
		
		
		override protected void OnInit(EventArgs e)
		{
			//HttpContext.Current.Response.Write("nome: " + Name);
			InitializeComponent();
			base.OnInit(e);
		}
		
		
		
		
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.OnLoad);
				
		}
		
		
		private void OnLoad(object sender, EventArgs e)
		{	
			//verifica di IDD rispetto il parametro RELATED
			if(CheckRelated()) {
				//puoi avviare il costrutture dell'url per l'ACMBox.
				string viewMode = this.getParameterValue("viewmode");
				//0 -->Semplice
				//1 -->Collegato
				//2 -->Entrambi
				string urlFileman = "";
				//Response.Write("VIEW MODE: " + viewMode);
				
				urlFileman = this.ComponentPath +"/fmanager.aspx" + "?inst=" + this.RelatedInstance;
				if(viewMode !="0")
					urlFileman += "&amp;celm=" + CurrentElement;
				setPopupUrl(urlFileman,"620","450");
				
			} else {
				Response.Write("NON TROVO RELAZIONE");
				this.Visible= false;
			}
			
			
			
		}
		
		
	}
}
